#ifndef TEXTREADER_H
#define TEXTREADER_H

#include <afx.h>

class CTextReader
	{
	protected:
		int line, col, cur;
		unsigned int spaces:1, skipcomments:1;

	private:
		virtual int getch() = 0;

	public:
		CTextReader(const int OnlySpaces = FALSE, const int SkipComments = FALSE);
		~CTextReader();
		virtual int CurC();
		int CurLineNo() { return line; } ;
		int CurColumn() { return col; } ;
		int NextC();
		int NextNonSpace();
		int GetC();
		int GetNonSpace();
		int GetName(char *s, int max);
		int GetString(char *s, int max, char *Delim = NULL);
		int GetString(CString &s, char *Delim = NULL);
		int GetInt(int &i);
	} ;


class CTextArchReader : public CTextReader
	{
	private:
		CArchive *arc;

	private:
		virtual int getch();

	public:
		CTextArchReader(CArchive &Arch, const int OnlySpaces = FALSE, 
			            const int SkipComments = FALSE);
		~CTextArchReader();
	} ;


class CTextBufferReader : public CTextReader
	{
	private:
		const char *bufp;

	private:
		virtual int getch();

	public:
		CTextBufferReader(const char *Buffer, const int OnlySpaces = FALSE, 
			              const int SkipComments = FALSE);
		~CTextBufferReader();
	} ;


#endif // TEXTREADER_H
